package cn.edu.nsmc.modules.sys.controller;

import cn.edu.nsmc.common.utils.R;
import cn.edu.nsmc.modules.sys.entity.SysVisitorEntity;
import cn.edu.nsmc.modules.sys.entity.data.UserStatistics;
import cn.edu.nsmc.modules.sys.form.VisitorList;
import cn.edu.nsmc.modules.sys.service.SysVisitorService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author ZY
 * @Date 2024/2/20 19:07
 */
@RestController
@RequestMapping("/sys/visitor")
public class SysVisitorController extends AbstractController{
    @Resource
    private SysVisitorService sysVisitorService;

    @PostMapping("addVisitor")
    private R addVisitor(@RequestBody SysVisitorEntity sysVisitorEntity){
        return sysVisitorService.addVisitor(sysVisitorEntity);
    }

    @PutMapping("updateVisitor")
    private R updateVisitor(@RequestBody SysVisitorEntity sysVisitorEntity){
        return sysVisitorService.updateVisitor(sysVisitorEntity);
    }

    @PutMapping("deleteVisitorByIds")
    private R deleteVisitorByIds(@RequestParam("ids") String[] ids){
        return sysVisitorService.deleteVisitorByIds(ids);
    }

    @PutMapping("deleteVisitorById/{id}")
    private R deleteVisitorById(@PathVariable Long id){
        return sysVisitorService.deleteVisitorById(id);
    }
    @PostMapping("getVisitorList")
    private R getVisitorList(@RequestBody VisitorList visitorList){
        return sysVisitorService.getVisitorList(visitorList);
    }
    @GetMapping("getVisitorById/{id}")
    private R getVisitorById(@PathVariable Long id){
        return sysVisitorService.getVisitorById(id);
    }

    @GetMapping("getInformation")
    private R getInformation(){
        return sysVisitorService.getInformation();
    }

    @PostMapping("getTypeNumber")
    private R getTypeNumber(@RequestBody UserStatistics userStatistics){
        return sysVisitorService.getTypeNumber(userStatistics);
    }
}
